#include"comm.h"

int main()
{
    int msgid = CreateMsgQueue();
    
    char buf[1024];
    while(1)
    {
        buf[0] = 0;
        RecvMsg(msgid, CLIENT_TYPE, buf);
        if(strcmp(buf, "quit") == 0)
        {
            printf("Client quit, me too!\n");
            break;
        }
        printf("Client say# %s\n", buf);
        printf("Please Enter# ");
        fflush(stdout);
        int s = read(0, buf, sizeof(buf));
        buf[s - 1] = 0;
        SendMsg(msgid, SERVER_TYPE, buf);
        printf("send done, wait recv...\n");
    }
    DestroyMsgQueue(msgid);
    return 0;
}
